
  function Encrypt(word){
     var key = CryptoJS.enc.Utf8.parse("abcdefgabcdefghi"); 

     var srcs = CryptoJS.enc.Utf8.parse(word);
     var encrypted = CryptoJS.AES.encrypt(srcs, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
         return encrypted.toString();
  }
  function Decrypt(word){
     var key = CryptoJS.enc.Utf8.parse("abcdefgabcdefghi"); 

     var decrypt = CryptoJS.AES.decrypt(word, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
     return CryptoJS.enc.Utf8.stringify(decrypt).toString();
  }


function dologin(){

$.ajax({
  type:"get",    
contentType: "application/json",
 headers:{'userToken':localStorage.userToken},
  url: AllUrl+'public/rsakey',

  success: function(data){
var username=$("#username").val();
var password =$("#password").val();

var verifyCode =$("#verifyCode").val();
       
  var encrypt = new JSEncrypt();
        encrypt.setPublicKey(data.dataResultObj.RsaKey);
        console.log("json.thePubKey:"+data.dataResultObj.RsaKey);
username=MD5(MD5(username));
password=MD5(MD5(password));
         username=encrypt.encrypt(username);
         password=encrypt.encrypt(password);

// console.log(username);
// console.log(password);
     

$.ajax({
  type:"post",    contentType: "application/json", 
  headers:{'AdminToken':localStorage.AdminToken},
  url: AllUrl+'system/admin/login',    
data:"{'username':'"+username+"','password':'"+password+"','IdentifyCode':'"+verifyCode+"'}",
  success: function(data){
console.log(localStorage.AdminToken)
    localStorage.AdminToken=data.dataResultObj.adminToken
                 console.log(data)     
            } 
         });
            } 
         });


}


 $("#verifyimg").click(function () {
ajaxcode()
            })






Window.onload = function(){
ajaxcode()
}



function ajaxcode(){
  $.ajax({
  type:"get",    contentType: "application/json", 
  headers:{'AdminToken':localStorage.AdminToken},
  url: AllUrl+'public/system/getverificode',    
data:new Date().getTime(),
  success: function(data){
    console.log(localStorage.AdminToken)
    localStorage.AdminToken=data.dataResultObj.LoginToken
  $("#verifyimg").attr("src", "data:image/png;base64,"+data.dataResultObj.CodeImg);



            } 
         });
}